<template>
    <div>
        <button @click="loginIn">登录</button>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { ref } from 'vue'
let router = useRouter()

let user = ref({})
const loginIn = ()=> {
    user.value = {
        id: 1,
        name: '胡飞扬',
        access: 1
    }
    localStorage.setItem('user', JSON.stringify(user.value))
    router.push('/layout')
}
</script>